package com.aiti.lulian.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.aiti.base.core.base.service.iml.BaseSerivceImpl;
import com.aiti.lulian.entity.LuLianAcquisitionGoods;
import com.aiti.lulian.mapper.LuLianAcquisitionGoodsMapper;
import com.aiti.lulian.service.ILuLianAcquisitionGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional(rollbackFor = Exception.class)
public class LuLianAcquisitionGoodsServiceImpl extends BaseSerivceImpl<LuLianAcquisitionGoodsMapper, LuLianAcquisitionGoods> implements ILuLianAcquisitionGoodsService {

    @Autowired
    private LuLianAcquisitionGoodsMapper luLianAcquisitionGoodsMapper;
    @Override
    public void saveData(List<LuLianAcquisitionGoods> goodsList, String acquisitionId) {
        if(CollectionUtil.isNotEmpty(goodsList)){
            for (LuLianAcquisitionGoods goods : goodsList) {
                goods.setAcquisitionId(acquisitionId);
                luLianAcquisitionGoodsMapper.insert(goods);
            }
        }
    }
}
